<html>
<head><meta charset="utf-8"><title>rust-analyzer and features · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20features.html">rust-analyzer and features</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="196360631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20features/near/196360631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> guigui64 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20features.html#196360631">(May 05 2020 at 20:10)</a>:</h4>
<p>Hi all, I'm using rust-analyzer on vim with coc.nvim (and the coc-rust-analyzer extension).</p>
<p>I have a lib crate (stybulate) in which I want to add  a binary to use the lib as a command-line app.<br>
Since I don't want people using my crate as a lib to have to compile the dependencies for the binary (structopt, anyhow etc.), I've created a feature called "build_binary" that is not in the default features and added this feature to the required-features of the [[bin]] section of my Cargo.toml.</p>
<p>Here is the content of my Cargo.toml file:</p>
<div class="codehilite"><pre><span></span><code><span class="k">[package]</span>
<span class="n">name</span> <span class="o">=</span> <span class="s">&quot;stybulate&quot;</span>
<span class="n">version</span> <span class="o">=</span> <span class="s">&quot;1.0.0&quot;</span>
<span class="n">authors</span> <span class="o">=</span> <span class="k">[&quot;Guillaume Comte &lt;guillaume.comte10@gmail.com&gt;&quot;]</span>
<span class="n">edition</span> <span class="o">=</span> <span class="s">&quot;2018&quot;</span>
<span class="n">license</span> <span class="o">=</span> <span class="s">&quot;MIT OR Apache-2.0&quot;</span>
<span class="n">readme</span> <span class="o">=</span> <span class="s">&quot;README.md&quot;</span>
<span class="n">repository</span> <span class="o">=</span> <span class="s">&quot;https://github.com/guigui64/stybulate&quot;</span>
<span class="n">homepage</span> <span class="o">=</span> <span class="s">&quot;https://github.com/guigui64/stybulate&quot;</span>
<span class="n">description</span> <span class="o">=</span> <span class="s">&quot;Tabulate with Style&quot;</span>
<span class="n">categories</span> <span class="o">=</span> <span class="k">[&quot;command-line-interface&quot;]</span>
<span class="n">exclude</span> <span class="o">=</span> <span class="k">[&quot;/.github/&quot;, &quot;/scripts/&quot;]</span>

<span class="c1"># See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html</span>

<span class="k">[features]</span>
<span class="n">default</span> <span class="o">=</span> <span class="k">[&quot;ansi_term_style&quot;]</span>
<span class="n">ansi_term_style</span> <span class="o">=</span> <span class="k">[&quot;ansi_term&quot;]</span>
<span class="n">build_binary</span> <span class="o">=</span> <span class="k">[&quot;anyhow&quot;, &quot;structopt&quot;]</span>

<span class="k">[dependencies]</span>
<span class="n">strip-ansi-escapes</span> <span class="o">=</span> <span class="s">&quot;0.1&quot;</span>
<span class="n">unicode-width</span> <span class="o">=</span> <span class="s">&quot;0.1&quot;</span>
<span class="n">ansi_term</span> <span class="o">=</span> <span class="p">{</span> <span class="n">version</span> <span class="o">=</span> <span class="s">&quot;0.12&quot;</span><span class="p">,</span> <span class="n">optional</span> <span class="o">=</span> <span class="n">true</span> <span class="p">}</span>
<span class="n">anyhow</span> <span class="o">=</span> <span class="p">{</span> <span class="n">version</span> <span class="o">=</span> <span class="s">&quot;1.0&quot;</span><span class="p">,</span> <span class="n">optional</span> <span class="o">=</span> <span class="n">true</span> <span class="p">}</span>
<span class="n">structopt</span> <span class="o">=</span> <span class="p">{</span> <span class="n">version</span> <span class="o">=</span> <span class="s">&quot;0.3&quot;</span><span class="p">,</span> <span class="n">optional</span> <span class="o">=</span> <span class="n">true</span> <span class="p">}</span>

<span class="k">[[bin]]</span>
<span class="n">name</span> <span class="o">=</span> <span class="s">&quot;stybulate&quot;</span>
<span class="n">required-features</span> <span class="o">=</span> <span class="k">[&quot;build_binary&quot;]</span>
</code></pre></div>


<p>Now, the issue is that rust-analyzer does not give diagnostics on the <a href="http://main.rs" title="http://main.rs">main.rs</a> file and I suspect it is because it does not run cargo check with the --all-features flag. Am I right?<br>
How can I enable the --all-features flag?</p>



<a name="196360927"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20features/near/196360927" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20features.html#196360927">(May 05 2020 at 20:13)</a>:</h4>
<p><code>rust-analyzer.checkOnSave.extraArgs</code> is the config name. Though, we probably should set <code>--all-features</code> by defaul</p>



<a name="196361935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20features/near/196361935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20features.html#196361935">(May 05 2020 at 20:22)</a>:</h4>
<p>(if you want to send a PR, you need to look into <code>flycheck</code> crate ;) )</p>



<a name="196362207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20features/near/196362207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> guigui64 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20features.html#196362207">(May 05 2020 at 20:24)</a>:</h4>
<p><span class="user-mention silent" data-user-id="133169">matklad</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/rust-analyzer.20and.20features/near/196361935" title="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/rust-analyzer.20and.20features/near/196361935">said</a>:</p>
<blockquote>
<p>(if you want to send a PR, you need to look into <code>flycheck</code> crate ;) )</p>
</blockquote>
<p>What ? I didn't find any crate with that name. I found an emacs extension with that name though...</p>



<a name="196362280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20features/near/196362280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20features.html#196362280">(May 05 2020 at 20:25)</a>:</h4>
<p>yup, that't the origin of the name. that's a internal crate in rust-analyzer repo</p>



<a name="196362531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%20and%20features/near/196362531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> guigui64 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.20and.20features.html#196362531">(May 05 2020 at 20:27)</a>:</h4>
<p>Ok thanks, I will send a PR then</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>